---
{
	"title": "Creating a pull request",
	"language": "en",
	"description": "How to create a pull request",
	"altLangPrefix": "pull",
	"dateModified": "2014-08-08"
}
---
<p>Pull requests are welcome. Please make sure your changes are to the latest code and limit the commit range to just the files you intended to change (to avoid conflicts).</p>
<ul>
	<li>To cut down on commit pollution in the main code base consider <a rel="external" href="https://git-scm.com/book/en/Git-Branching-Rebasing">rebasing</a> your commits before you create a pull request to the main branch.</li>
</ul>

<section>
	<h2>New components</h2>
	<p>Should be added in a feature-* branch (e.g., feature-lightbox) that is created off of the master branch.</p>
	<ul>
		<li>Create the a fresh branch off master by using:
			<ul>
				<li><code>git fetch upstream</code></li>
				<li><code>git checkout upstream/master</code></li>
				<li><code>git checkout -b my-cool-new-feature</code></li>
			</ul>
		</li>
		<li>Licensing for all new components and supporting code must be compatible with the MIT license used by WET.</li>
		<li>New plugins should use the same structure and formatas existing plugins.</li>
		<li>Include the WET terms and conditions comment block in all text-based source files that fall under Crown Copyright.</li>
	</ul>
</section>

<section>
	<h2>Bug fixes and patches that apply to all versions</h2>
	<p>Should be submitted to the master branch.</p>
	<ul>
		<li>Create a fresh branch off of master by using:
			<ul>
				<li><code>git fetch upstream</code></li>
				<li><code>git checkout upstream/master</code></li>
				<li><code>git checkout -b my-patch-description</code></li>
			</ul>
		</li>
	</ul>
</section>

<section>
	<h2 id="test">Testing your PR before submitting</h2>
	<ul>
		<li>
			Validate your HTML markup as to ensure well-formed HTML5.
			<ul>
				<li>These tests will be run as part of the default build, or by calling <code>grunt htmllint</code> to run the task on your built HTML.</li>
				<li>You can manually test for well-formed markup using the <a rel="external" href="https://validator.w3.org/nu/">W3C HTML validator</a>. Validate with an XHTML5 preset and a checkmark next to "Be lax about HTTP Content-Type".</li>
			</ul>
		</li>
		<li>
			<a rel="external" href="https://jigsaw.w3.org/css-validator/#validate_by_uri+with_options">Validate your CSS</a> with the following changes to the default settings:
			<ul>
				<li><strong>Profile:</strong> CSS level 3</li>
				<li><strong>Vendor extensions:</strong> Warnings</li>
			</ul>
		</li>
		<li><a rel="external" href="https://eslint.org/">Validate your JavaScript code</a>. This validation is done by calling <code>grunt eslint</code></li>
		<li><a href="opt-en.html">Optimize your JavaScript, CSS and HTML code</a></li>
		<li>Formatting recommendations:
			<ul>
				<li>Indenting can be enforced by installing an <a href="https://editorconfig.org">EditorConfig</a> plugin for your preferred <abbr>IDE</abbr></li>
				<li>Indent with tabs using the <a rel="external" href="https://en.wikipedia.org/wiki/Indent_style#K.26R_style">K&amp;R indenting style</a></li>
				<li>Use double quotes for strings in JavaScript (so unescaped single quotes can be used for attributes in HTML output)</li>
			</ul>
		</li>
		<li>
			Test Web pages against the following browser test baseline:
			<ul>
				<li>The current and previous major version of each browser that accounts for at least 5 per cent of visits<sup id="fn1-rf"><a class="fn-lnk" href="#fn1"><span class="wb-inv">Footnote </span>1</a></sup> to the website;</li>
				<li>Any major version of a browser that, on its own, accounts for at least 5 per cent of visits<sup id="fn2-rf"><a class="fn-lnk" href="#fn1"><span class="wb-inv">Footnote </span>1</a></sup> to the website; and</li>
				<li>The current major version of each mobile browser that accounts for at least 5 per cent of mobile device visits<sup id="fn3-rf"><a class="fn-lnk" href="#fn1"><span class="wb-inv">Footnote </span>1</a></sup>.</li>
			</ul>
		</li>
		<li>PR testing is done by <a rel="external" href="https://github.com/wet-boew/wet-boew/actions">GitHub Actions</a>, but the same set of tests can be run using <code>grunt dist</code> locally before you submit</li>
	</ul>
</section>

<section>
	<h2>Commit Messages</h2>
	<p>When committing changes for a pull request, your commit message should start off with the name of the affected plugin(s) or topic, followed by a colon and a short description of what's changed. A longer description can also optionally be included. If the commit resolves a pre-existing issue on GitHub, include "Fixes #issue-id." as a part of the long description.</p>
	<dl>
		<dt>Message example</dt>
		<dd><code>Plugin name/topic: Short description of the change. <br>(Optional) Long description of the change. Fixes #1715.</code></dd>
		<dt>Command line example</dt>
		<dd><code>git commit -m "Plugin name/topic: Short description of the change." -m "(Optional) Long description of the change. Fixes #1715."</code></dd>
	</dl>
</section>

<aside class="wb-fnote" role="note">
	<h2 id="fn">Footnotes</h2>
	<dl>
		<dt>Footnote 1</dt>
		<dd id="fn1">
			<p>For Government of Canada websites: Visits to all public-facing Government of Canada websites and web applications, excluding visits from Government of Canada workstations.</p>
			<p class="fn-rtn">
				<a href="#fn1-rf"><span class="wb-inv">Return to footnote </span>1<span class="wb-inv"> referrer</span></a>
			</p>
		</dd>
	</dl>
</aside>
